(function () {
  let timerId
  function setRem() {
    if (document.documentElement.clientWidth > 500) {
      clearTimeout(timerId)
      timerId = setTimeout(() => {
        document.documentElement.style.fontSize =50+'px'
      }, 500);
    }
  }
  setRem()
  window.onresize = function() {
    setRem();
  };
})();